package com.TeamJigsaw.DanteTrail.Models;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;

public class GameSprite {
	public Point position;
	private Image picture;
	public int width;
	public int height;
	public double xSpeed;
	public double ySpeed;
	
	public GameSprite(int x, int y, Image picture, int width, int height, int xSpeed, int ySpeed) {
		position = new Point(x-width/2,y-height/2);
		this.picture = picture;
		this.width = width;
		this.height = height;
		this.xSpeed = xSpeed;
		this.ySpeed = ySpeed;
	}
	
	public GameSprite(int x, int y, Image picture, int width, int height) {
		this(x,y,picture,width,height,0,0);
	}
	
	public GameSprite(int x, int y, Image picture) {
		this(x,y,picture,picture.getHeight(null), picture.getWidth(null));
	}
	
	public void update() {
		position.x += xSpeed;
		position.y += ySpeed;
	}
	
	public void draw(Graphics g) {
		g.drawImage(picture, position.x, position.y, null);
	}
	
	public Image getImage() {
		return picture;
	}
	
	/**
	 * Returns a string representation of the gamesprite
	 * @return A string representation of the gamesprite
	 */
	@Override
	public String toString() {
		return ("This is a game sprite. It's image is " + picture.toString());
	}
}
